package edu.sctu.springbootdemo.controller;

import edu.sctu.springbootdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
public class IndexController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "")
    public ModelAndView index() {


        ModelAndView model = new ModelAndView();
        model.addObject("list", userService.findAll());
        model.setViewName("/index");
        return model;
    }
}
